{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c7d41bce-aff6-48f5-930d-9e804f563250",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "w= [2.13756953] b= [90.78228498]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from sklearn.linear_model import LinearRegression\n",
    "x = np.array([[100],[113],[90],[89],[60],[70],[50],[45],[55],[78]])\n",
    "y = np.array([[301],[324],[285],[296],[200],[260],[300],[120],[180],[245]])\n",
    "model = LinearRegression()\n",
    "model.fit(x,y)\n",
    "print(\"w=\",model.coef_[0],\"b=\",model.intercept_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7c6a446f-d6e9-416b-8163-e3ad35f56115",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200平方米二手房的预测房价是:  518.2961916987591\n"
     ]
    }
   ],
   "source": [
    "a = model.predict([[200]])\n",
    "print(\"200平方米二手房的预测房价是: \",a[0][0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "32c4ee77-7d47-4d49-9f69-7088105089eb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
